package com.example.a22310.myapplication.Dailog;

import android.app.DialogFragment;
import android.os.Bundle;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.view.WindowManager;
import android.widget.LinearLayout;

import com.example.a22310.myapplication.Activity.TrainDetail;

public class ConsultDialog extends DialogFragment {
    public ConsultDialog() {
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        // Inflate the layout for this fragment

        View view = inflater.inflate(R.layout.dialog_consult, container,
                false);
        Window win = getDialog().getWindow();
        WindowManager.LayoutParams lp = win.getAttributes();
        win.setGravity(Gravity.CENTER_HORIZONTAL| Gravity.BOTTOM);
        lp.alpha = 0.9f;
        win.setAttributes(lp);


        LinearLayout layout_online = (LinearLayout) view.findViewById(R.id.layout_online);
        layout_online.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                // TODO Auto-generated method stub
                ((TrainDetail) getActivity()).jumpToActivity();
                ConsultDialog.this.dismiss();
            }

        });

        LinearLayout layout_tel = (LinearLayout) view.findViewById(R.id.layout_tel);
        layout_tel.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                // TODO Auto-generated method stub
                ((TrainDetail) getActivity()).callPhone();
                ConsultDialog.this.dismiss();
            }

        });

        return view;
    }

}
